package com.yanqu.road.server.manager.activity.suitang.task.impl;

import com.yanqu.road.entity.activity.suitang.data.CrossSuiTangCity;
import com.yanqu.road.entity.activity.suitang.data.CrossSuiTangData;
import com.yanqu.road.entity.activity.suitang.entity.battle.CrossSuiTangBattlefieldTeam;
import com.yanqu.road.entity.activity.suitang.enums.eSuiTangStage;
import com.yanqu.road.entity.activity.suitang.enums.eSuiTangTaskType;
import com.yanqu.road.entity.activity.suitang.enums.eSuiTangWarType;
import com.yanqu.road.entity.enums.eTongBingTaskType;
import com.yanqu.road.server.manager.activity.suitang.activity.CrossSuiTangActivity;
import com.yanqu.road.server.manager.activity.suitang.task.BaseCrossSuiTangTask;
import com.yanqu.road.server.manager.activity.tongbing.activity.CrossTongBingActivity;
import com.yanqu.road.server.manager.activity.tongbing.task.BaseCrossTongBingTask;
import com.yanqu.road.utils.date.DateHelper;
import com.yanqu.road.utils.executor.GeneralTask;

import java.util.Map;

public class CrossSuiTangMoveTask extends GeneralTask {

    private CrossSuiTangActivity activity;

    public CrossSuiTangMoveTask(CrossSuiTangActivity activity) {
        this.activity = activity;
    }

    @Override
    public void doRun() {
        if (activity.getCrossSuiTangData().getStep().getValue() >= eSuiTangStage.Stage1EndTime.getValue()) {
            this.cancel(false);
            return;
        }

        CrossSuiTangData crossSuiTangData = activity.getCrossSuiTangData();
        if (crossSuiTangData == null) {
            return;
        }
        Map<eSuiTangWarType, Map<Integer, Map<Integer, CrossSuiTangCity>>> roundMap = crossSuiTangData.getCityMap().get(activity.calcRound());
        if (roundMap == null || roundMap.isEmpty()) {
            return;
        }

        for (Map<Integer, Map<Integer, CrossSuiTangCity>> warTypeMap : roundMap.values()) {
            for (Map<Integer, CrossSuiTangCity> actGroupMap : warTypeMap.values()) {
                activity.getMapActivityMgr().crossSuiTangMoveTask(actGroupMap);
            }
        }
    }
}
